ed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
authorOwen Taylor <otaylor@src.gnome.org>
Wed, 15 Nov 2000 21:12:58 +0000 (21:12 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 15 Nov 2000 21:12:58 +0000 (21:12 +0000)
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.

* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.

* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktextdisplay.c
gtk/gtktextlayout.c
gtk/gtktextview.c

index 2aa3385d213a2a3f475989a80cb16693d4519d46..f90476222a58b4087b4deee44857f2a6fe523a6d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Wed Nov 15 16:02:20 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
+       unconditionally, since we may need to update the horizontal
+       scrollbars even if the height didn't change.
+
+       * gtk/gtktextlayout.c (add_preedit_attrs): Always get
+       the extra attrs, since some of them affect size.
+
+       * gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
+       x_offset correctly.
+
 2000-11-15  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextlayout.c (set_para_values): If indent is negative,
index 2aa3385d213a2a3f475989a80cb16693d4519d46..f90476222a58b4087b4deee44857f2a6fe523a6d 100644 (file)
@@ -1,3 +1,15 @@
+Wed Nov 15 16:02:20 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
+       unconditionally, since we may need to update the horizontal
+       scrollbars even if the height didn't change.
+
+       * gtk/gtktextlayout.c (add_preedit_attrs): Always get
+       the extra attrs, since some of them affect size.
+
+       * gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
+       x_offset correctly.
+
 2000-11-15  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextlayout.c (set_para_values): If indent is negative,
index 2aa3385d213a2a3f475989a80cb16693d4519d46..f90476222a58b4087b4deee44857f2a6fe523a6d 100644 (file)
@@ -1,3 +1,15 @@
+Wed Nov 15 16:02:20 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
+       unconditionally, since we may need to update the horizontal
+       scrollbars even if the height didn't change.
+
+       * gtk/gtktextlayout.c (add_preedit_attrs): Always get
+       the extra attrs, since some of them affect size.
+
+       * gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
+       x_offset correctly.
+
 2000-11-15  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextlayout.c (set_para_values): If indent is negative,
index 2aa3385d213a2a3f475989a80cb16693d4519d46..f90476222a58b4087b4deee44857f2a6fe523a6d 100644 (file)
@@ -1,3 +1,15 @@
+Wed Nov 15 16:02:20 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
+       unconditionally, since we may need to update the horizontal
+       scrollbars even if the height didn't change.
+
+       * gtk/gtktextlayout.c (add_preedit_attrs): Always get
+       the extra attrs, since some of them affect size.
+
+       * gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
+       x_offset correctly.
+
 2000-11-15  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextlayout.c (set_para_values): If indent is negative,
index 2aa3385d213a2a3f475989a80cb16693d4519d46..f90476222a58b4087b4deee44857f2a6fe523a6d 100644 (file)
@@ -1,3 +1,15 @@
+Wed Nov 15 16:02:20 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
+       unconditionally, since we may need to update the horizontal
+       scrollbars even if the height didn't change.
+
+       * gtk/gtktextlayout.c (add_preedit_attrs): Always get
+       the extra attrs, since some of them affect size.
+
+       * gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
+       x_offset correctly.
+
 2000-11-15  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextlayout.c (set_para_values): If indent is negative,
index 2aa3385d213a2a3f475989a80cb16693d4519d46..f90476222a58b4087b4deee44857f2a6fe523a6d 100644 (file)
@@ -1,3 +1,15 @@
+Wed Nov 15 16:02:20 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
+       unconditionally, since we may need to update the horizontal
+       scrollbars even if the height didn't change.
+
+       * gtk/gtktextlayout.c (add_preedit_attrs): Always get
+       the extra attrs, since some of them affect size.
+
+       * gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
+       x_offset correctly.
+
 2000-11-15  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextlayout.c (set_para_values): If indent is negative,
index 2aa3385d213a2a3f475989a80cb16693d4519d46..f90476222a58b4087b4deee44857f2a6fe523a6d 100644 (file)
@@ -1,3 +1,15 @@
+Wed Nov 15 16:02:20 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
+       unconditionally, since we may need to update the horizontal
+       scrollbars even if the height didn't change.
+
+       * gtk/gtktextlayout.c (add_preedit_attrs): Always get
+       the extra attrs, since some of them affect size.
+
+       * gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
+       x_offset correctly.
+
 2000-11-15  Havoc Pennington  <hp@redhat.com>
 
        * gtk/gtktextlayout.c (set_para_values): If indent is negative,
index ebe457549cd307b04db18f4a56fbc3d7ea4f50a2..104a278ecf82ae6bc152e3e7edca4475e70424b0 100644 (file)
@@ -668,8 +668,8 @@ void
 gtk_text_layout_draw (GtkTextLayout *layout,
                       GtkWidget *widget,
                       GdkDrawable *drawable,
-                      /* Location of the layout
-                         in buffer coordinates */
+                      /* Location of the drawable
+                         in layout coordinates */
                       gint x_offset,
                       gint y_offset,
                       /* Region of the layout to
@@ -782,9 +782,9 @@ gtk_text_layout_draw (GtkTextLayout *layout,
             gc = widget->style->fg_gc[GTK_STATE_NORMAL];
 
           gdk_draw_line (drawable, gc,
-                         line_display->x_offset + cursor->x,
+                         line_display->x_offset + cursor->x - x_offset,
                          current_y + line_display->top_margin + cursor->y,
-                         line_display->x_offset + cursor->x,
+                         line_display->x_offset + cursor->x - x_offset,
                          current_y + line_display->top_margin + cursor->y + cursor->height - 1);
 
           cursor_list = cursor_list->next;
index f6c1e755e456e0881ef34cec37a8ac574413c092..01d76ddab3c8cb28b62a2e7e2478c49cee1412a7 100644 (file)
@@ -480,17 +480,8 @@ gtk_text_layout_get_size (GtkTextLayout *layout,
                           gint *width,
                           gint *height)
 {
-  gint w, h;
-
   g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
 
-  gtk_text_btree_get_view_size (_gtk_text_buffer_get_btree (layout->buffer),
-                                layout,
-                                &w, &h);
-
-  layout->width = w;
-  layout->height = h;
-
   if (width)
     *width = layout->width;
 
@@ -739,6 +730,14 @@ gtk_text_layout_is_valid (GtkTextLayout *layout)
                                   layout);
 }
 
+static void
+update_layout_size (GtkTextLayout *layout)
+{
+  gtk_text_btree_get_view_size (_gtk_text_buffer_get_btree (layout->buffer),
+                               layout,
+                               &layout->width, &layout->height);
+}
+
 /**
  * gtk_text_layout_validate_yrange:
  * @layout: a #GtkTextLayout
@@ -835,13 +834,17 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout,
       line = gtk_text_line_next (line);
     }
 
-  /* If we found and validated any invalid lines, emit the changed singal
+  /* If we found and validated any invalid lines, update size and
+   * emit the changed signal
    */
   if (first_line)
     {
-      gint line_top =
-        gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer),
-                                      first_line, layout);
+      gint line_top;
+
+      update_layout_size (layout);
+
+      line_top = gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer),
+                                              first_line, layout);
 
       gtk_text_layout_changed (layout,
                                line_top,
@@ -874,6 +877,8 @@ gtk_text_layout_validate (GtkTextLayout *layout,
                                   &y, &old_height, &new_height))
     {
       max_pixels -= new_height;
+
+      update_layout_size (layout);
       gtk_text_layout_changed (layout, y, old_height, new_height);
     }
 }
@@ -1475,7 +1480,7 @@ add_preedit_attrs (GtkTextLayout     *layout,
        end = layout->preedit_len;
       
       pango_attr_iterator_get_font (iter, &style->font,
-                                   &font_desc, size_only ? NULL : &extra_attrs);
+                                   &font_desc, &extra_attrs);
       
       tmp_list = extra_attrs;
       while (tmp_list)
index c1112fc8aff9a06ed9ef9d12147b92b98b9897e6..72ca677464728d736237263a794b64dd7fec12ed 100644 (file)
@@ -2141,11 +2141,11 @@ changed_handler (GtkTextLayout *layout,
           yoffset_changed = TRUE;
         }
 
-      gtk_text_view_scroll_calc_now (text_view);
-
       if (yoffset_changed)
         gtk_adjustment_value_changed (get_vadjustment (text_view));
     }
+  
+  gtk_text_view_scroll_calc_now (text_view);
 }
 
 static void
@@ -3539,25 +3539,8 @@ gtk_text_view_scroll_calc_now (GtkTextView *text_view)
 
   gtk_text_layout_get_size (text_view->layout, &width, &height);
 
-#if 0
-  /* If the width is less than the screen width (likely
-     if we have wrapping turned on for the whole widget),
-     then we want to set the scroll region to the screen
-     width. If the width is greater (wrapping off) then we
-     probably want to set the scroll region to the width
-     of the layout. I guess.
-  */
-
-  width = MAX (text_view->layout->screen_width, width);
-  height = height;
-#endif
-
   if (text_view->width != width || text_view->height != height)
     {
-#if 0
-      printf ("layout size set, widget width is %d\n",
-              GTK_WIDGET (text_view)->allocation.width);
-#endif
       text_view->width = width;
       text_view->height = height;